package com.google.coffeeshop.dao.impl;

import java.util.List;

import com.google.coffeeshop.dao.ProductGroupDAO;
import com.google.coffeeshop.entity.EmployeeDTO;
import com.google.coffeeshop.entity.ProductGroupDTO;
import com.googlecode.genericdao.search.Search;


public class ProductGroupDAOImpl extends AbstractBaseDAOImpl<ProductGroupDTO, Long> implements ProductGroupDAO {

	@Override
	public ProductGroupDTO findProductGroupById(Long id) {
		ProductGroupDTO productGroup = find(id);
		if (productGroup != null) {
			return productGroup;
		}
		return null;
	}

	@Override
	public List<ProductGroupDTO> getAllProductGroup() {
		Search search = new Search(ProductGroupDTO.class);
		search.setFirstResult(0);
		search.setMaxResults(Integer.MAX_VALUE);
		List<ProductGroupDTO> groups = this.search(search);
		if (null == groups || groups.isEmpty()){
			return null;
		}
		return groups;
	}

}
